package com.dxtan90.config;

import com.dxtan90.utils.PropertiesReadUtils;

/**
 * @author: shijunhao
 * @date: 2021/12/1 22:05
 * @description: 系统配置文件
 */
public class SysConfig {
    private Double sameLine;
    private String operationFilePath;
    private Boolean infinite;


    public SysConfig loadConfig(){
        String sameLine = PropertiesReadUtils.getValue("sameLine");

        if(sameLine == null || "".equals(sameLine.trim())){
            this.sameLine = 1.0;
        }else{
            this.sameLine = Double.valueOf(sameLine);
        }

        this.operationFilePath = PropertiesReadUtils.getValue("path.operation");
        this.infinite = Boolean.valueOf(PropertiesReadUtils.getValue("infinite"));
        if(this.operationFilePath == null || "".equals(this.operationFilePath.trim()))
            throw new RuntimeException("配置文件不能为空");

        return this;
    }

    public Double getSameLine() {
        return sameLine;
    }

    public void setSameLine(Double sameLine) {
        this.sameLine = sameLine;
    }

    public String getOperationFilePath() {
        return operationFilePath;
    }

    public void setOperationFilePath(String operationFilePath) {
        this.operationFilePath = operationFilePath;
    }

    public Boolean getInfinite() {
        return infinite;
    }

    public void setInfinite(Boolean infinite) {
        this.infinite = infinite;
    }
}
